package com.hqyj.cloudAccount;

import com.hqyj.cloudAccount.config.CustomLoadBalancerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@LoadBalancerClient(name = "spring-cloud-test",configuration = CustomLoadBalancerConfiguration.class)
@EnableFeignClients
public class CloudAccountApplication {

    public static void main(String[] args) {
        SpringApplication.run(CloudAccountApplication.class, args);
    }



    /*
    * 实现远程调用的方法，意为一个微服务调用另一个微服务
    * main也是设置类，可以在这里写
    * loadbalanced是设置负载均衡
    * */
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }


}


